package com.txunda.zhuohired.http;

import com.ants.theantsgo.base.BaseView;
import com.ants.theantsgo.config.Config;
import com.ants.theantsgo.httpTools.ApiTool2;
import com.lidroid.xutils.http.RequestParams;

import java.io.File;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/29 9:35
 * 功能描述：企业认证
 * 联系方式：jiahuanchen@126.com
 */

public class Company {
    private static String url = Config.BASE_URL + "Company/";

    /**
     * 获取规模
     *
     * @param baseView
     */
    public void scale(BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        apiTool.postApi(url + "scale", params, baseView);
    }

    /**
     * 企业认证提价
     *
     * @param token            登录注册时传递的id
     * @param company_name     企业名称
     * @param trade_id         行业id
     * @param scale_id         规模id
     * @param address_province 企业地址-省
     * @param address_city     企业地址-市
     * @param address_area     企业地址-区
     * @param company_desc     企业简介
     * @param company_phone    行政电话
     * @param logo             企业logo
     * @param company_pic      企业风采
     * @param baseView
     */
    public void companyIn(String token, String company_name, String trade_id, String scale_id, String address_province,
                          String address_city, String address_area, String company_desc, String company_phone, File
                                  logo, File company_pic, String address_street, String address_door, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("company_name", company_name);
        params.addBodyParameter("trade_id", trade_id);
        params.addBodyParameter("scale_id", scale_id);
        params.addBodyParameter("address_province", address_province);
        params.addBodyParameter("address_city", address_city);
        params.addBodyParameter("address_area", address_area);
        params.addBodyParameter("company_desc", company_desc);
        params.addBodyParameter("company_phone", company_phone);
        params.addBodyParameter("address_street", address_street);
        params.addBodyParameter("address_door", address_door);
        if (logo != null && logo.exists())
            params.addBodyParameter("logo", logo);
        params.addBodyParameter("company_pic", company_pic);
        if (company_pic != null && company_pic.exists())
            params.addBodyParameter("company_pic", company_pic);
        apiTool.postApi(url + "companyIn", params, baseView);
    }

    /**
     * 企业认证法人提交
     *
     * @param business_license 营业执照图片
     * @param identity_card    身份证图片
     * @param token            登录注册回传的id
     * @param baseView
     */
    public void companyLegalIn(File business_license, File identity_card, String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        if (business_license != null && business_license.exists())
            params.addBodyParameter("business_license", business_license);
        if (identity_card != null && identity_card.exists())
            params.addBodyParameter("identity_card", identity_card);
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "companyLegalIn", params, baseView);
    }

    /**
     * 审核失败
     *
     * @param id       登录注册回传的id
     * @param baseView
     */
    public void companyError(String id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("id", id);
        apiTool.postApi(url + "companyError", params, baseView);
    }

    /**
     * 推荐首页
     *
     * @param token
     * @param trade_id   行业ID
     * @param p          分页参数
     * @param order      1为推荐 2为最热可以空
     * @param shooling   学历ID 可以空
     * @param experience 经验ID 可以空
     * @param salary     薪水ID 可以空
     * @param baseView
     */
    public void shareIndex(String token, String trade_id, String p, String order,
                           String shooling, String experience, String salary,
                           BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("trade_id", trade_id);
        params.addBodyParameter("p", p);
        params.addBodyParameter("order", order);
        params.addBodyParameter("shooling", shooling);
        params.addBodyParameter("experience", experience);
        params.addBodyParameter("salary", salary);
        apiTool.postApi(url + "shareIndex", params, baseView);
    }

    /**
     * 发布职位检查
     *
     * @param token
     * @param baseView
     */
    public void checkPostJob(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "checkPostJob", params, baseView);
    }

    /**
     * 查看发布职位
     *
     * @param token
     * @param job_type
     * @param status_type
     * @param p
     * @param baseView
     */
    public void isjobList(String token, String job_type, String status_type,String p, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("job_type", job_type);
        params.addBodyParameter("status_type", status_type);
        params.addBodyParameter("p", p);
        apiTool.postApi(url + "isjobList", params, baseView);
    }

    /**
     * 获取公司名称
     *
     * @param token
     * @param baseView
     */
    public void companyName(String token, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        apiTool.postApi(url + "companyName", params, baseView);
    }

    /**
     * 发布全职职位
     *
     * @param position_id
     * @param token
     * @param recruit
     * @param address_province
     * @param address_city
     * @param address_area
     * @param address_street
     * @param address_door
     * @param work_time
     * @param welfare
     * @param recruit_lat
     * @param recruit_lng
     * @param salary_min
     * @param salary_max
     * @param claim_experience
     * @param claim_shooling
     * @param position_good
     * @param job_claim
     * @param job_duty
     * @param job_id
     * @param baseView
     */
    public void allPublishJob(String position_id, String token, String recruit,
                              String address_province, String address_city,
                              String address_area, String address_street,
                              String address_door, String work_time,
                              String welfare, String recruit_lat, String recruit_lng,
                              String salary_min, String salary_max,
                              String claim_experience, String claim_shooling,
                              String position_good, String job_claim,
                              String job_duty, String job_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("position_id", position_id);
        params.addBodyParameter("token", token);
        params.addBodyParameter("recruit", recruit);
        params.addBodyParameter("address_province", address_province);
        params.addBodyParameter("address_city", address_city);
        params.addBodyParameter("address_area", address_area);
        params.addBodyParameter("address_street", address_street);
        params.addBodyParameter("address_door", address_door);
        params.addBodyParameter("work_time", work_time);
        params.addBodyParameter("welfare", welfare);
        params.addBodyParameter("recruit_lat", recruit_lat);
        params.addBodyParameter("recruit_lng", recruit_lng);
        params.addBodyParameter("salary_min", salary_min);
        params.addBodyParameter("salary_max", salary_max);
        params.addBodyParameter("claim_experience", claim_experience);
        params.addBodyParameter("claim_shooling", claim_shooling);
        params.addBodyParameter("position_good", position_good);
        params.addBodyParameter("job_claim", job_claim);
        params.addBodyParameter("job_duty", job_duty);
        params.addBodyParameter("job_id", job_id);
        apiTool.postApi(url + "allPublishJob", params, baseView);
    }

    /**
     * 发布兼职职位
     *
     * @param token
     * @param position_id
     * @param merger_name
     * @param address_province
     * @param address_city
     * @param address_area
     * @param merger_lat
     * @param merger_lng
     * @param merger_address
     * @param date_start
     * @param date_end
     * @param work_time
     * @param clearing
     * @param merger_price
     * @param merger_claim
     * @param merger_responsibility
     * @param merger_education
     * @param merger_experience
     * @param job_id
     * @param baseView
     */
    public void partPublishJob(String token, String position_id,
                               String merger_name, String address_province,
                               String address_city, String address_area,
                               String merger_lat, String merger_lng,
                               String merger_address, String date_start,
                               String date_end, String work_time,
                               String clearing, String merger_price,
                               String merger_claim, String merger_responsibility,
                               String merger_education, String merger_experience,
                               String job_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("position_id", position_id);
        params.addBodyParameter("merger_name", merger_name);
        params.addBodyParameter("address_province", address_province);
        params.addBodyParameter("address_city", address_city);
        params.addBodyParameter("address_area", address_area);
        params.addBodyParameter("merger_lat", merger_lat);
        params.addBodyParameter("merger_lng", merger_lng);
        params.addBodyParameter("merger_address", merger_address);
        params.addBodyParameter("date_start", date_start);
        params.addBodyParameter("date_end", date_end);
        params.addBodyParameter("work_time", work_time);
        params.addBodyParameter("clearing", clearing);
        params.addBodyParameter("merger_price", merger_price);
        params.addBodyParameter("merger_claim", merger_claim);
        params.addBodyParameter("merger_responsibility", merger_responsibility);
        params.addBodyParameter("merger_education", merger_education);
        params.addBodyParameter("merger_experience", merger_experience);
        params.addBodyParameter("job_id", job_id);
        apiTool.postApi(url + "partPublishJob", params, baseView);
    }


    /**
     * 全职职位修改
     *
     * @param token
     * @param job_id
     * @param baseView
     */
    public void updateAllJob(String token, String job_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("job_id", job_id);
        apiTool.postApi(url + "updateAllJob", params, baseView);
    }


    /**
     * 兼职职位修改
     *
     * @param token
     * @param job_id
     * @param baseView
     */
    public void updatePartJob(String token, String job_id, BaseView baseView) {
        RequestParams params = new RequestParams();
        ApiTool2 apiTool = new ApiTool2();
        params.addBodyParameter("token", token);
        params.addBodyParameter("job_id", job_id);
        apiTool.postApi(url + "updatePartJob", params, baseView);
    }


}
